﻿using System;
using HiTeachers.Services;

namespace HiTeachers.Web
{
    public partial class ListStudentRequest : PageBase
    {
        private const int NumNewInPage = 40;
        protected void Page_Load(object sender, EventArgs e)
        {
            var curPage = string.IsNullOrEmpty(Request["p"]) ? 0 : Convert.ToInt32(Request["p"]) - 1;
            rptStdRequest.DataSource = StudentRequestServices.GetVerifiedRequest(NumNewInPage, curPage);
            rptStdRequest.DataBind();

            BindingPage();
        }

        #region Private Methods
        private void BindingPage()
        {
            var totalNew = StudentRequestServices.TotalVerifiedRequest();
            var totalPage = (int)Math.Ceiling((double)totalNew / NumNewInPage);
            var curPage = string.IsNullOrEmpty(Request["p"]) ? 1 : Convert.ToInt32(Request["p"]);

            BindingPaper(ltrPaper, "ListStudentRequest.aspx", curPage, totalPage);
        }
        #endregion
    }
}
